package cn.tedu.jewelry.mapper;

import cn.tedu.jewelry.entity.Brand;
import cn.tedu.jewelry.vo.BrandStandVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

//品牌模块
@Mapper
public interface BrandMapper {

    //获取品牌列表
    @Result(column = "brand_name",property = "brandName")
    @Select("select * from brand")
    List<BrandStandVO> getBrandList();

    //添加品牌
    @Insert("insert into brand values(null,#{brandName},0)")
    void insert(String brandName);

    //通过品牌id获取品牌信息
    @Result(column = "brand_name",property = "brandName")
    @Select("select * from brand where id=#{id}")
    BrandStandVO getBrandById(Long id);

    //id删除品牌
    @Delete("delete from brand where id=#{id}")
    void deleteBrandById(Long id);

    //修改品牌启用状态
    @Update("update brand set enable=#{enable} where id=#{id}")
    void updateBrandByIdAndEnable(Long id,Integer enable);
}
